//package lib.WordNet;
//
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Iterator;
//import java.util.List;
//
//import org.apache.lucene.document.Document;
//import org.apache.lucene.index.CorruptIndexException;
//import org.apache.lucene.index.Term;
//import org.apache.lucene.search.Hits;
//import org.apache.lucene.search.IndexSearcher;
//import org.apache.lucene.search.TermQuery;
//import org.apache.lucene.store.FSDirectory;
//import org.apache.lucene.wordnet.Syns2Index;
//
///*
// * Created on Nov 27, 2009
// *
// * TODO To change the template for this generated file go to
// * Window - Preferences - Java - Code Style - Code Templates
// */
//
///**
// * @author Danish Contractor (dcontrac@in.ibm.com)
// *
// * TODO To change the template for this generated type comment go to
// * Window - Preferences - Java - Code Style - Code Templates
// */
//public class WordNet {
//	public static List suggestWordNetSynonyms(String word) throws IOException
//	{
//	List suggestions=new ArrayList();
//    FSDirectory directory = null;
//	try {
//		directory = FSDirectory.getDirectory("lib/WordNet/WORDNETINDEX", false);
//	} catch (IOException e) {
//		// TODO Auto-generated catch block
//		e.printStackTrace();
//	}
//	IndexSearcher searcher = null;
//	try {
//		searcher = new IndexSearcher(directory);
//	} catch (CorruptIndexException e1) {
//		// TODO Auto-generated catch block
//		e1.printStackTrace();
//	} catch (IOException e1) {
//		// TODO Auto-generated catch block
//		e1.printStackTrace();
//	}
//	Term term=new Term(Syns2Index.F_WORD, word);
//	Hits hits = searcher.search(new TermQuery(term));
//
//	/*if (hits.length() == 0) {
//		System.out.println("No synonyms found for " + word);
//	} else {
//		System.out.println("Synonyms found for \"" + word + "\":");
//	}*/
//
//		if(hits.length()>0)
//		{
//	    Document doc = hits.doc(0);
//		String[] values = doc.getValues(Syns2Index.F_SYN);
//		suggestions=Arrays.asList(values);
//		}
//		
//
//	searcher.close();
//	directory.close();
//	return suggestions;
//	}
//	public static void main(String[] args) throws Exception {
//		
//		List sugg = suggestWordNetSynonyms("save");
//		Iterator i1 = sugg.iterator();
//		while(i1.hasNext())
//			System.out.println((String)i1.next());		
//	}
//}
